import { ConfigService } from '@nestjs/config';
import { UserService } from './user.service';
import { Controller, Get, Post } from '@nestjs/common';
import { ConfigEnum } from 'src/enum/config.enum';

@Controller('user')
export class UserController {
  constructor(
    private userService: UserService,
    private configService: ConfigService,
  ) {}

  @Get()
  getUsers(): any {
    // const db = this.configService.get(ConfigEnum.DB);
    // const dbHost = this.configService.get(ConfigEnum.DB_HOST);
    // const dbUrl = this.configService.get(ConfigEnum.DB_URL);
    // const dbPort = this.configService.get(ConfigEnum.DB_PORT);
    // console.log(db);
    // console.log(dbHost);
    // console.log(dbUrl);
    // console.log(dbPort);
    // const dbPass = this.configService.get(ConfigEnum.DB_PASS);
    // console.log(dbPass);
    // const data = this.configService.get('database')
    // console.log(data);
    return this.userService.getUsers();
  }

  @Post('add')
  addUser(): any {
    return this.userService.addUser();
  }
}
